package com.bootssm.service.impl;

import com.bootssm.dao.StudentMapper;
import com.bootssm.enity.Student;
import com.bootssm.enity.StudentQueryVO;

import com.bootssm.service.StudentService;
import com.bootssm.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    StudentMapper studentMapper;
    @Autowired
    IdWorker idWorker;


    @Override
    public List<Student> findAll(StudentQueryVO studentQueryVO) {
        return studentMapper.findAll(studentQueryVO);
    }

    @Override
    public void deleteById(String id) {
        studentMapper.deleteById(id);
    }

    @Override
    public Student findById(String id) {
        return studentMapper.findById(id);
    }

    @Override
    public void insert(Student student) {
        student.setId(idWorker.nextId()+"");
        studentMapper.insert(student);
    }

    @Override
    public void update(Student student) {
        studentMapper.update(student);
    }

    @Override
    public Integer getCount(StudentQueryVO studentQueryVO) {
        return studentMapper.getCount(studentQueryVO);
    }
}
